import java.util.Random;
import java.util.Scanner;


public class 最大公约数 {
    public static void main4(String[] args) {
        //猜数字游戏
        Random random = new Random();

        int num = random.nextInt(100);//[0,100)
        Scanner scan = new Scanner(System.in);
        while (true) {
            System.out.println("输入你猜的数字：");
            int i = scan.nextInt();
            if (i == num) {
                System.out.println("恭喜你!猜对了");
                break;
            } else if (i > num) {
                System.out.println("猜大了");
            } else {
                System.out.println("猜小了");
            }
        }
    }



    public static void main3(String[] args) {
        //水仙花数
        for (int i = 1; i < 999999; i ++){

            //先判断是几位数
            int fla = i;
            int count = 0;
//            if (fla % 10 != 0)
//            {
//                count++;
//            }
            while (fla != 0){

                count++;
                fla /= 10;
            }
            fla = i;
            int sum = 0;
            while (fla != 0){

                sum += Math.pow(fla % 10, count);
                fla /= 10;
            }
            if (sum == i){

                System.out.println(sum);
            }

        }
    }
    public static void main2(String[] args) {
        //分数计算
        double sum = 0;
        int flag = 1;
        for (int i = 1; i <= 100; i++)
        {
            sum += 1.0 / i * flag;//不应该是整形
            //i *= -1;破坏了for循环里的条件
            flag = -flag;

        }
        System.out.println(sum);
    }
    public static void main1(String[] args) {
        int i = 36;
        int j = 42;
        int str = 1;
        int min = Math.min(i, j);
        for (int k = 1; k <= min; k++)
        {
            if (i % k == 0 && j % k == 0)
            {
                str = k;
            }
            //System.out.println(str);
        }
        System.out.println(str);


    }
}
